package cn.com.cdb.ldms.ftz.dto.in;

import cn.com.cdb.ldms.annotation.V;
import cn.com.cdb.ldms.base.BaseParam;
import cn.com.cdb.ldms.base.page.DateType;
import cn.com.cdb.ldms.base.page.annotation.FieldConfig;
import cn.com.cdb.ldms.base.page.annotation.Option;
import cn.com.cdb.ldms.base.page.annotation.Validation;
import cn.com.cdb.ldms.base.page.annotation.ViewConfig;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 部门 传输层实体
 *
 * @author liukui
 * @since 2025-06-26
 */
@Data
@Tag(name = "部门", description = "部门请求参数")
@ViewConfig(title = "部门列表", searchable = true)
public class DeptIn extends BaseParam {
    @FieldConfig(
            label = "姓名",
            showInTable = true,
            order = 4,
            searchable = true,
            searchPlaceholder = "请输入姓名",
            searchValidations = {
                    @Validation(type = "required", message = "姓名不能为空")
            },
            editable = true,
            formValidations = {
                    @Validation(type = "required", message = "姓名不能为空"),
                    @Validation(type = "minLength", message = "姓名至少2个字符")
            }
    )
    @V(notNull = true, minLength = 2)
    @Schema(description = "姓名",requiredMode = Schema.RequiredMode.REQUIRED)
    private String name;

    @FieldConfig(
            label = "年龄",
            showInTable = true,
            order = 2,
            editable = true,
            formValidations = {
                    @Validation(type = "required", message = "年龄不能为空"),
                    @Validation(type = "min", message = "年龄必须大于0", min = 0),
                    @Validation(type = "max", message = "年龄必须小于150", max = 150)
            }
    )
    private Integer age;

    @FieldConfig(
            label = "性别",
            showInTable = true,
            order = 3,
            searchable = true,
            searchType = "select",
            options = {
                    @Option(label = "男", value = "male"),
                    @Option(label = "女", value = "female")
            },
            editable = true,
            formType = "select",
            formValidations = {
                    @Validation(type = "required", message = "请选择性别")
            }
    )
    private String gender;

    @FieldConfig(
            label = "创建时间",
            showInTable = true,
            order = 1,
            searchable = true,
            searchType = "date",
            searchDateType = DateType.DATERANGE,
            editable = false
    )
    private LocalDateTime createTime;
}
